package com.iterator;


import java.util.Iterator;
import java.util.List;


public class InfoCollegeIterator implements Iterator {

    // 这里我们需要Department 是以怎样的方式存放
    List<Department> departmentList;
    int index = -1;//遍历的位置

    public InfoCollegeIterator(List<Department> departmentList) {
        this.departmentList = departmentList;
    }

    //判断是否还有下一个元素
    @Override
    public boolean hasNext() {
        if(index >= departmentList.size() - 1){
            return false;
        }else {
            index += 1;
            return true;
        }
    }

    @Override
    public Object next() {
        return departmentList.get(index);
    }

    // 删除的方法默认空实现

    @Override
    public void remove() {
        
    }
}
